// app.js
require('./monitor/index.js').mount();
const Monitor = require("./monitor/monitor")
const domain = "https://gemo-applet.oss-cn-hangzhou.aliyuncs.com";
App({
  onLaunch(options) {
    console.log('options: ', options);
    // 展示本地存储能力
    let inviterId = 0;
    if (options.query.inviterId) {
      inviterId = options.query.inviterId;
      wx.setStorageSync('inviterId', inviterId);
    }

    const logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs)
    // 初始化 Monitor
    Monitor.setStoreInit(options);

    this.Monitor = Monitor;
    if (wx.getStorageSync('openid')) {
      Monitor.init({
        openid: wx.getStorageSync('openid'),
        ad_id: options.query.ad_id,
        url_link_id: options.query.url_link_id,
        short_link_id: options.query.short_link_id,
        debug: true,
      });
    }

  },
  globalData: {
    userInfo: null,
    imgUri: domain + '/mp/one/images',
    cdn: domain,
    share_title: '欢迎来到GEMO金茉',
    share_image: domain + '/mp/one/images/share_image.jpg',
    share_url: '/pages/home/home',
  }
})